package web;

import com.nf.mvc.ViewResult;
import com.nf.mvc.exception.ExceptionHandler;
import com.nf.mvc.vo.ResponseVO;

import static com.nf.mvc.handler.HandlerHelper.json;

public class GlobalException {
    /* @ExceptionHandler(AException.class)
     public void handleA(AException e) {

     }

     @ExceptionHandler(BException.class)
     public void handleB(AException e) {

     }
 */
    @ExceptionHandler(RuntimeException.class)
    public ViewResult handleRuntime(RuntimeException e) {
        return json(new ResponseVO(500, "yunxingshi"));
    }

    @ExceptionHandler(ArithmeticException.class)
    public ViewResult handleArithmeticException(ArithmeticException e) {
        return json(new ResponseVO(500, "suanshu"));
    }
}
